import { createRouter, createWebHistory } from 'vue-router'
import index from '../view/index.vue'
import user from '../view/user.vue'
import car from '@/view/car.vue'
import order from '@/view/order.vue'
import evaluation from '@/view/evaluation.vue'
import driver from '../view/driver.vue'
import admin from '../view/admin.vue'
import driverApproval from '../view/driver-approval.vue'
// 乘客端页面
import placeOrder from '../view/passenger/place-order.vue'
import driverApplication from '../view/passenger/driver-application.vue'
import UserMap from "@/view/passenger/UserMap.vue";
import MapContainer from "@/view/passenger/MapContainer.vue";
// 登录相关页面
import login from '../view/login.vue'
import register from '../view/register.vue'
import forgotPassword from '../view/forgotPassword.vue'
import { ElMessage } from 'element-plus'



const routes = [
    {
        path: '/login',
        name: 'login',
        component: login
    },
    {
        path: '/register',
        name: 'register',
        component: register
    },
    {
        path: '/forgot-password',
        name: 'forgotPassword',
        component: forgotPassword
    },
    {
        path: '/index',
        name: 'index-alias',
        component: index
    },
    {
        path:'/',
        name:'index',
        component:index,
        children:[
            {path: 'driver-approval', component:driverApproval},
            {path:'user',component:user},
            {path:'driver',component:driver},
            {path:'admin',component:admin},
            {path:'car',component:car},
            {path:'order',component:order},
            {path:'evaluation',component:evaluation/*,meta:{requiresAuth:true,role:'管理员'}*/},
            // 乘客端路由
            {path:'passenger/UserMap',component:UserMap},
            {path:'passenger/place-order',component:placeOrder},
            {path:'passenger/driver-application',component:driverApplication},
        ]
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router;
